< previous page page_737 next page >

Page 737
Also, as I stated previously, most of the code from your original form is copied over to the UserDocument. Invalid code is commented out and identified by the ActiveX Document Migration Wizard. (This result assumes that you chose to comment out invalid code on the Options page of the wizard.) Figure 32.14 shows an example of this process.
0737-01.jpg
Figure 32.14
Invalid code is identified by the [
AXDW] mark in a comment statement.
Creating a More Complex Document
Obviously, only so much room is available on a UserDocument object. Therefore, you are limited in the amount of information that can be displayed in a single document. In this regard, a single document is like an application with a single form. However, you can create additional documents as part of your project and then navigate among the various documents. You can also include standard forms in the applications that you create with ActiveX documents. In the following sections, you look at the details involved in using multiple documents and forms in your ActiveX documentbased application.
Programming Additional Documents
To use additional documents in your ActiveX application, you need to create the additional documents and then provide a mechanism for moving back and forth between the documents. This process is somewhat different than moving between forms in a standard program because the UserDocument object does not support the Load and Unload statements, or the Show and Hide methods that are available to forms.
To add another document to your project, you first need to add another UserDocument object to the project. You do so by choosing Add User Document from the Project menu. This action places a second (or third, fourth, and so on) document in your project, under the UserDocuments folder. As with the first document you created, you need to specify a name for the document.
The next step requires you to draw the interface of the additional document and add the code that enables it to perform its tasks. This process is the same as the one you used to create the original document.
Now for the tricky part. Because you cannot use the Show method to display a document (as you can with forms), how do you get back and forth between the various documents in your application? The answer is to use the NavigateTo method of the Hyperlink object. The NavigateTo method instructs a container application to go to a particular file or URL and load the page. If the file is an ActiveX document, it gets processed just like your original page.

 
< previous page page_737 next page >